package com.fulihui.systemcore.dal.convertor;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.beans.BeanUtils;

import com.fulihui.systemcore.dal.dataobj.PosProvince;
import com.fulihui.systemcore.dto.PosProvinceDTO;

public class ProvinceConv {
    private static final String[] ignore = { "id" };

    public static PosProvince convert2DO(PosProvinceDTO mo_) {
        if (mo_ == null) {
            return null;
        }

        PosProvince do_ = new PosProvince();
        BeanUtils.copyProperties(mo_, do_, ignore);

        return do_;
    }

    public static PosProvinceDTO convert2DTO(PosProvince do_) {
        if (do_ == null) {
            return null;
        }

        PosProvinceDTO mo_ = new PosProvinceDTO();
        BeanUtils.copyProperties(do_, mo_, ignore);

        return mo_;
    }

    public static List<PosProvinceDTO> convert2List(List<PosProvince> list) {
        return list.stream().map((t) -> {
            return convert2DTO(t);
        }).collect(Collectors.toList());
    }
}